package club.caihappy.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by 百岁 on 2021/10/2
 **/
@ConfigurationProperties(prefix = "person")
//加载指定配置文件
//@PropertySource("classpath:cai.properties")
@Component
@Data
@AllArgsConstructor
@NoArgsConstructor
@Validated//数据校验
public class Person {
    //SPEl表达式取值
//    @Value("${name}")
    @Email(message = "邮箱格式错误")
    private String lastName;
    private Integer age;
    private boolean happy;
    private Date birth;
    private Map<String, Object> maps;
    private List<Object> list;
    private Dog dog;

}
